#include <iostream>
using namespace std;

class Student
{
public:
    Student(string name, string record, bool flag = false)
    {
        this->name = name;
        this->record = record;
    }
    bool isLate()
    {
        int flag1 = 0, flag2 = 0;

        for (int i = 0; i < record.size() - 2; i++)
        {
            if (record.at(i) == 'A')
            {
                flag1++;
            }
            else if (record.at(i) == 'L' && record.at(i + 1) == 'L' && record.at(i + 2) == 'L')
            {
                flag2 = 1;
            }
        }
        if (flag1 >= 2)
        {
            this->flag = true;
        }
        if (flag2 == 1)
        {
            this->flag = true;
        }
        return flag;
    }

    void show()
    {
        if (this->flag == true)
        {
            cout << "姓名：" << name << "  " << "是否及格：" << "不及格" << endl;
        }
        else
        {
            cout << "姓名：" << name << "  " << "是否及格：" << "及格" << endl;
        }
    }

private:
    string name;
    string record;
    bool flag;
};

int main()
{
    string str1 = "ALLPPP";
    string str2 = "ALPPPLPPPPLPP";
    Student s1("张三", str1);
    Student s2("李四", str2);

    s1.isLate();

    s1.show();

    return 0;
}